// gui/GuiHotSpotRect.cpp

#include "GuiHotSpotRect.h"

#include <gfx/Frame.h>

using namespace GUI;

bool GuiHotSpotRect::IsInside(float fX, float fY) const
{
	const GFX::Frame * pFrame = GetFrame();

	if (pFrame)
	{
		const Math::mat4 matInvWorld = pFrame->GetWorldMatirx().Inverse();
		Math::vec3 vWorldPos = matInvWorld.MultiplyTransform3( Math::vec3( fX, fY, 0.0f) );

		fX = vWorldPos.x;
		fY = vWorldPos.y;
	}

	return (fX >= m_fRect[E_BOUNDS_LEFT] && fY <= m_fRect[E_BOUNDS_TOP]
		&& fX <= m_fRect[E_BOUNDS_RIGHT] && fY >= m_fRect[E_BOUNDS_BOTTOM] );
}